/* 通用样式和变量定义 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}

:root {
    --primary-color: #2385bb;
    --secondary-color: #7cbde6;
    --success-color: #5cb85c;
    --warning-color: #f0ad4e;
    --danger-color: #d9534f;
    --gray-color: #6c757d;
    --light-gray: #f8f9fa;
    --border-color: #eee;
    --sidebar-width: 240px;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 通用按钮样式 */
.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-add-user {
    background-color: #2385bb;
    color: #FFFFFF;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #2585bb;
}
.btn-default {
    background-color: #ecf0f1;
    color: #2c3e50;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d9534f;
}

.btn-delete-user {
    background-color: #d9534f;
    color: #FFFFFF;
}

.btn-modify-user, .btn-batch-import, .btn-export-user {
    background-color: #2585bb;
    color: #FFFFFF;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-modify-user:hover, .btn-batch-import:hover, .btn-export-user:hover {
    background-color: #2585bb;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: visible;
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #2c3e50;
}

.modal-close-btn {
    background-color: transparent;
    border: none;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    position: absolute;
    right: 15px;
    top: 15px;
    z-index: 10;
}

.modal-close-btn:hover {
    background-color: #f5f5f5;
    color: #000;
    transform: rotate(90deg);
}

.modal-close-btn i {
    pointer-events: none;
}

.modal-content form {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* 密码容器 */
.password-container {
    position: relative;
}

.password-toggle-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 错误提示 */
.error-text {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

/* 验证状态 */
.is-valid {
    border-color: var(--success-color) !important;
}

.is-invalid {
    border-color: var(--danger-color) !important;
}

/* 密码强度 */
.password-strength {
    font-size: 12px;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    color: white;
    display: none;
}

.password-strength.short {
    background-color: var(--danger-color);
    display: block;
}

.password-strength.weak {
    background-color: var(--warning-color);
    display: block;
}

.password-strength.medium {
    background-color: #f0ad4e;
    display: block;
}

.password-strength.strong {
    background-color: var(--success-color);
    display: block;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-footer button {
        width: 100%;
    }
}

/* 键盘可访问性 */
.modal:focus-within {
    outline: none;
}

/* 屏幕阅读器支持 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(35, 133, 187, 0.2);
}

/* 表格样式 */
.table-container {
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    font-size: 14px;
}

td {
    font-size: 14px;
    vertical-align: middle;
}

/* 状态按钮样式 */
.status-btn {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
}

.status-btn.active {
    background-color: #28a745;
    color: white;
}

.status-btn.inactive {
    background-color: #6c757d;
    color: white;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 5px;
}

.pagination a {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: var(--primary-color);
}

.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination a:hover:not(.active) {
    background-color: #f5f5f5;
}

/* 自定义下拉多选组件 */
.custom-multiselect {
    position: relative;
}

.multiselect-header {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 12px 15px;
    background-color: white;
    cursor: pointer;
}

.multiselect-input {
    flex: 1;
    border: none;
    outline: none;
    background-color: transparent;
    font-size: 16px;
}

.multiselect-toggle-btn {
    background-color: transparent;
    border: none;
    font-size: 14px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.multiselect-toggle-btn i {
    transition: transform 0.3s;
}

.custom-multiselect.open .multiselect-toggle-btn i {
    transform: rotate(180deg);
}

.multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.custom-multiselect.open .multiselect-dropdown {
    display: block;
}

.multiselect-search {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.multiselect-search input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.multiselect-options {
    padding: 5px;
}

.multiselect-option {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.multiselect-option:hover {
    background-color: #f5f5f5;
}

.multiselect-option.selected {
    background-color: rgba(35, 133, 187, 0.1);
    border-left: 3px solid var(--primary-color);
}

.multiselect-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.multiselect-option label {
    position: relative;
    padding-left: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.multiselect-option label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 3px;
    background-color: white;
}

.multiselect-option input[type="checkbox"]:checked + label::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 12px;
    border: solid var(--primary-color);
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.d-none {
    display: none;
}

/* 自定义单选框组样式 */
.custom-radio-group {
    display: flex;
    gap: 20px;
    align-items: center;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-option label {
    position: relative;
    padding-left: 24px;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
}

.radio-option label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    background-color: white;
}

.radio-option input[type="radio"]:checked + label::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--primary-color);
}

.radio-option input[type="radio"]:checked + label::before {
    border-color: var(--primary-color);
}

.radio-option.focused label::before {
    box-shadow: 0 0 0 2px rgba(35, 133, 187, 0.2);
    border-color: var(--primary-color);
}

/* 响应式设计 - 小屏幕上确保单选框正确显示 */
@media (max-width: 768px) {
    .custom-radio-group {
        flex-wrap: wrap;
    }
}

/* 操作链接样式 */
.operation a {
    color: var(--primary-color);
    text-decoration: none;
    margin-right: 10px;
}

.operation a:hover {
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .content {
        padding: 15px;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .search-box {
        width: 100%;
    }
    
    .search-box input {
        flex: 1;
    }
}

/* 批量导入模态框样式 */
.batch-import-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
    flex: 1;
}

.batch-import-container h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.batch-import-container h4 i {
    color: var(--primary-color);
}

/* 导入区域 */
.import-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.import-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 上传框 */
.upload-box {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.upload-box:hover {
    border-color: var(--primary-color);
    background: #f0f8ff;
}

.upload-box.drag-over {
    border-color: var(--primary-color);
    background: #e6f3ff;
}

.upload-box i.fa-cloud-upload-alt {
    font-size: 48px;
    color: var(--primary-color);
}

.upload-box p {
    margin: 0;
    color: #666;
}

.upload-box p.hint {
    font-size: 12px;
    color: #999;
}

/* 文件信息 */
.file-info {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.file-details i.fa-file-excel {
    font-size: 32px;
    color: #1d6f42;
}

.file-name {
    font-weight: 500;
    color: #333;
    margin-right: 10px;
}

.file-size {
    font-size: 12px;
    color: #999;
}

.btn-remove-file {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.btn-remove-file:hover {
    background: #c82333;
}

/* 导入操作按钮 */
.import-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-download-template {
    background: white;
    border: 1px solid #ccc;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-download-template:hover {
    background: #f5f5f5;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 导入历史区域 */
.history-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.history-table-container {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.history-table thead {
    background: #f8f9fa;
}

.history-table th {
    padding: 12px 8px;
    text-align: left;
    font-weight: 500;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.history-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f0;
}

.history-table tbody tr:hover {
    background: #f8f9fa;
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.download-failed-link {
    color: var(--primary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.download-failed-link:hover {
    text-decoration: underline;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .batch-import-container {
        padding: 15px;
        gap: 20px;
    }

    .upload-box {
        padding: 30px 15px;
    }

    .upload-box i.fa-cloud-upload-alt {
        font-size: 36px;
    }

    .import-actions {
        flex-direction: column;
    }

    .import-actions button {
        width: 100%;
    }

    .history-table {
        font-size: 12px;
    }

    .history-table th,
    .history-table td {
        padding: 8px 4px;
    }
}